package com.cpf.spring;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @author cpf email: cpfprogrammer@163.com
 * {@code @date} 2022/11/9 上午11:22
 */
@SpringBootApplication
public class ConfigLoadOrderApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext ct = SpringApplication.run(ConfigLoadOrderApplication.class, args);
        ConfigurableEnvironment environment = ct.getEnvironment();
        System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        System.out.println(environment.getProperty("resource.yaml"));
        System.out.println(environment.getProperty("resource.yml"));
        System.out.println(environment.getProperty("resource.properties") + "\n");

        System.out.println(environment.getProperty("resource.config.yaml"));
        System.out.println(environment.getProperty("resource.config.yml"));
        System.out.println(environment.getProperty("resource.config.properties") + "\n");

        System.out.println(environment.getProperty("root.yaml"));
        System.out.println(environment.getProperty("root.yml"));
        System.out.println(environment.getProperty("root.properties") + "\n");

        System.out.println(environment.getProperty("root.config.yaml"));
        System.out.println(environment.getProperty("root.config.yml"));
        System.out.println(environment.getProperty("root.config.properties") + "\n");

        System.out.println(environment.getProperty("root.config.*.yaml"));
        System.out.println(environment.getProperty("root.config.*.yml"));
        System.out.println(environment.getProperty("root.config.*.properties") + "\n");

        System.out.println("a = " + environment.getProperty("a"));
        System.out.println("b = " + environment.getProperty("b"));
        System.out.println("c = " + environment.getProperty("c"));
        System.out.println("d = " + environment.getProperty("d"));
        System.out.println("e = " + environment.getProperty("e"));
        System.out.println("f = " + environment.getProperty("f"));
        System.out.println("g = " + environment.getProperty("g"));
        System.out.println("h = " + environment.getProperty("h"));
        System.out.println("i = " + environment.getProperty("i"));
        System.out.println("j = " + environment.getProperty("j"));
        System.out.println("k = " + environment.getProperty("k"));
        System.out.println("l = " + environment.getProperty("l"));
        System.out.println("m = " + environment.getProperty("m"));
        System.out.println("n = " + environment.getProperty("n"));
        System.out.println("o = " + environment.getProperty("o"));

        System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    }
}
